The present invention relates to a step motor control device for controlling a step motor to drive sufficiently, more particularly, to a step motor control device for controlling intervals between each pulse to be applied to a step motor.
Conventionally, a typical step motor control device has been provided with a pulse table for storing therein a time interval between each pulse to be applied to a step motor besides a work memory STEP1 (simplified as STEP1 hereinafter) for counting remaining steps to be performed by the step motor and another work memory STEP2 (simplified as STEP2 hereinafter) for counting steps from the beginning of the perfomance of the step motor.
Table 1 shows an example of the pulse table. DATANO indicates the order of data in the table. Table size (simplified as TBSIZE hereinafter), which informs the number of the data in the table, is ten in this case.
TABLE 1 ______________________________________ DATANO 0 1 2 3 4 5 6 7 8 9 ______________________________________ PULSE TIME 4.0 3.0 3.4 3.1 2.7 3.1 3.4 3.9 4.0 30.0 (msec.) ______________________________________
For the convenience, the pulse time corresponding to the DATANO will be transcribed as PULSTB(DATANO) hereinafter. For instance, the pulse time when DATANO=3 is 3.1 (msec.), which is transcribed as PULSTB(3)=3.1 (msec.). According to Table 1, when the accelerated performance of the step motor is required, pulse time data corresponding to DATANO of 0 through 3 are sequentially read out of the pulse table and pulses are applied to the step motor in accordance with the read-out pulse time data. When constant performance is required, pulse is applied to the step motor corresponding to PULSTB(4). When decelerated performance is required, pulse is applied to the step motor in accordance with the pulse time PULSTB(5) through PULSTB(9) which are sequentially read out of the pulse table in this order.
FIG. 1 is a flowchart illustrating a main control routine of the conventional motor control device, and FIG. 2 is a flowchart illustrating an interruption procedure for driving the step motor.
First, data is inputted at step S61. In step S62, the procedure according to the inputted data is executed. If the inputted data requires motor performance (YES in step S63), the procedure goes to step S64. Note that, the requirements of the motor performance is generated when steps for a single or an additional performance are inputted. If NO in step S64, the procedure returns to step S61. At step S64, the interruption procedure of the step motor is inhibited and parameters for the control routine are set in steps S65 through S68 of FIG. 1. When the procedure goes to step S69, an interruption procedure for the performance of the step motor is permitted. The interruption procedure of the step motor is illustrated in a flowchart of FIG. 2. In this procedure, a phase of the pulse is updated at step S83 and the pulse is outputted to the step motor in step S84. The parameters are updated in steps S84 through S86. At step S85, it is examined whether (STEP2), or the value stored in STEP2 is FFH (FF in hexa decimal) or not. If it is determined that (STEP2)=FFH, then step S86 is skipped. It is because that if (STEP2) is increased at step S86 when (STEP2) is FFH, (STEP2) will be 00H (00 in hexa decimal) since STEP2 is a two-bit memory in this case. In other words, FFH is an upper limit of (STEP2). Next, it is examined whether (STEP1) is greater than or equal to (STEP2). If it is determined YES at step S87, it is further examined whether (STEP2) is greater than TBSIZE/2 or not (TBSIZE is a fixed value). If NO in step S87, the procedure goes to step S89. In step S89, DATANO is set to be (STEP2)-1, which is referred to the case of acceleration performance. And PULSTB(DATANO), or the pulse time data corresponding to the DATANO is transmitted into an accumulator, not shown, in step S90. On the other hand, if it is determined YES in step S88, the procedure goes to step S92. It is the constant performance case. And, the pulse time data is transmitted into the accumulater, in step S93. If it is determined NO in step S87, it is further examined whether (STEP1) is greater than or equal to TBSIZE/2 . If it is determined YES, then the procedure goes to step S92 (the constant performance condition). If NO, the procedure goes into the deceleration performance, where a flag DOWN is set in step S94. Then, DATANO is set at step S95, and a pulse time is transmitted into the accumulater at step S96. After the pulse time having been set at step S90, S93 or S96, the set value in the accumulater is transmitted to a time register, not shown, in step S97. Pulse time interval is managed in response to the value stored in the time register. Then the interruption routine is passed through, and the procedure returns to the point in FIG. 1 where a main control procedure has been interrupted. Note that, in FIG. 1, in steps S69 and S61 through S63, the interruption procedure is permitted to execute after the period of time set in the time register at step S97 of FIG. 2, while in steps S64 through S71, the interruption procedure is inhibited. If it is determined YES in step S70, where the flag DOWN is ON and the step motor is in the deceleration performance, the interruption procedure is permitted in step S72. Note that, when in the decelerated condition, the procedure looped in steps S64, S65, S70 and S72 until (STEP1) becomes zero. It means that a performance requiring additional steps cannot be accepted when the step motor is driven in the decelerated condition.
When the motor is required to perform continuously, if the motor is in the decelerated condition (NO, in step S70), the number of steps is added to the (STEP1) and stored in STEP1 in step S71, and the motor is remained performing continuously.
The numbers of the pulse time data stored in the pulse table, which is TBSIZE, is 2n, which are numbered 0 through 2n-1 (DATANO=0 through 2n-1), respectively. The (n-1)-th data is a data for constant speed data, that is, EQU n-1=TBSIZE/2
and this number n-1 is called a boundary number, and n-th through (2n-1)-th data are deceleration data.
For example, it is assumed that TBSIZE=10, and thirteen steps of a single performance is required (see TABLE 2). TABLE 1 is utilized as a pulse table for this case.
TABLE 2 __________________________________________________________________________ (STEP 1) 12 11 10 9 8 7 6 5 4 3 2 1 0 (STEP 2) 1 2 3 4 5 6 7 8 9 10 11 12 13 TBSIZE/2 5 5 5 5 5 5 5 5 5 5 5 5 5 DATANO 0 1 2 3 4 4 4 4 5 6 7 8 9 CONDITION ACCELERATED CONSTANT DECELERATED __________________________________________________________________________
In first four steps, i.e., (STEP1) counts 12 down to 9, (STEP1) is greater than (STEP2) and (STEP2) is greater than TBSIZE/2, therefore DATANO=(STEP2)-1.
In next step where (STEP1)=8, (STEP1) is greater than (STEP2) and (STEP2)=TBSIZE/2, therefore DATANO=TBSIZE/2-1.
In next step where (STEP1)=7, (STEP1) is greater than (STEP2) and (STEP2) is greater than TBSIZE/2, therefore DATANO=TBSIZE/2-1.
In next two steps, i.e., (STEP1) counts 6 down to 5, (STEP1) is less than (STEP2) and (STEP1) is greater than TBSIZE/2, therefore DATANO=TBSIZE-1.
In last five steps, i.e., (STEP1) counts 4 down to zero, (STEP1) is less than (STEP2) and (STEP1) is less than TBSIZE/2, therefore DATANO=TBSIZE-(STEP1)-1. Boldfaced numerals represent values utilized for figuring the DATANO.
Thus, the performance of the step motor according to the pulse table (TABLE 1) is as follows:
five steps of accelerated performance; PA1 three steps of constant performance; and PA1 five steps of decelerated performance. PA1 three steps of acceleration performance; and PA1 three steps of deceleration performance, PA1 without constant performance.
TABLE 3 shows another example of six steps of a single performance of the step motor. In this case, first three steps is performed in accelerated condition (abbreviated as ACCEL. in TABLE 3) and last three steps, in decelerated condition (abbreviated as DECEL. in TABLE 3).
TABLE 3 ______________________________________ (STEP 1) 5 4 3 2 1 0 (STEP 2) 1 2 3 4 5 6 TBSIZE/2 5 5 5 5 5 5 DATANO 0 1 2 7 8 9 CONDITION ACCEL. DECEL. ______________________________________
This six steps of a single performance including:
In the conventional motor control device, when the requirement for a continuous performance is generated during accelerated condition, the motor can perform continuously, but the requirement of an additional performance cannot be accepted during decelerated condition, therefore the motor is once stopped and then required steps of another performance is to be executed.
For example, assume the case that TBSIZE=10 and the requirement for performances are six steps and three steps and three steps and . . . (it is assumed that the requirement of each performance are to be generated by every three pulses). Note that, TABLE 1 is used as a pulse table also in this case.
TABLE 4 ______________________________________ ADDITIONAL -- -- -- 3 -- -- # -- -- STEPS (STEP 1) 5 4 3 5 4 3 2 1 0 (STEP 2) 1 2 3 4 5 6 7 8 9 TBSIZE/2 5 5 5 5 5 5 5 5 5 DATANO 0 1 2 3 5 6 7 8 9 CONDITION ACCELERATED DECELERATED ______________________________________
In this case, at the fourth step, where the performance is in accelerated condition, the requirement for additional three steps of performance is generated, the motor can perform continuously. As newly required steps are as small as three steps, the accelerated condition is finished at fourth step and the condition is changed to decelerated one at the fifth step. As aforementioned, PULSTB(0) through PULSTB(3) correspond to the accelerated condition and PULSTB(5) through PULSTB(9) correspond to the decelerated condition. Next, the three steps of the following performance is required at the seventh step. Since the step motor performs in decelerated condition, the continuous performance cannot be executed. The requirement for the additional performance is not accepted until the continuous performance is finished.
To overcome the discontinuity in the performance of the step motor when the required steps for continuous performance is relatively small, for example, it may be suggested to lessen the value of constant data TBSIZE/2. When TBSIZE is set six in above described case, performance transfers in constant condition after two steps of accelerated condition, and requirements at third and sixth steps can be accepted because the performance is in constant condition.
If the boundary value, or TBSIZE/2 is set small as above, however, the performing speed of the motor in the constant condition becomes relatively small.
Another way to overcome above deficiencies is to utilize a step motor capable of changing its performance condition from decelerated one to accelerated one. However, such a motor is expensive, further, requires a complicated control system.